<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>抽奖配置管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="sys:user:edit"><li class="active"><a href="${ctx}/wechat/lotteryConfig/">抽奖配置列表</a></li></shiro:hasPermission>
		<shiro:hasPermission name="wechat:lotteryConfig:edit"><li><a href="${ctx}/wechat/lotteryConfig/form">抽奖配置</a></li></shiro:hasPermission>
		<shiro:hasPermission name="wechat:lottery:view"><li><a href="${ctx}/wechat/lottery/">奖品列表</a></li></shiro:hasPermission>
		<shiro:hasPermission name="wechat:lottery:edit"><li><a href="${ctx}/wechat/lottery/form">奖品添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="lotteryConfig" action="${ctx}/wechat/lotteryConfig/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<label>名称 ：</label><form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
		&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead><tr>
		<shiro:hasPermission name="sys:user:edit"><th>所属商家</th></shiro:hasPermission>
		<!-- <th>名称</th> -->
		<th>中奖率</th>
		<th>有效时间</th>
		<th>是否开启</th>
		<th>是否扣分</th>
		<th>是否重复</th>
		<th>扣除分值（元）</th>
		<shiro:hasPermission name="wechat:lotteryConfig:edit"><th>操作</th></shiro:hasPermission></tr></thead>
		<tbody>
		<c:forEach items="${page.list}" var="lotteryConfig">
			<tr>
				<shiro:hasPermission name="sys:user:edit"><td>${lotteryConfig.user.name}</td></shiro:hasPermission>
				<%-- <td><a href="${ctx}/wechat/lotteryConfig/form?id=${lotteryConfig.id}">${lotteryConfig.name}</a></td> --%>
				<td>${lotteryConfig.percent}</td>
				<td>${lotteryConfig.validDays}</td>
				<td>
					<c:if test="${lotteryConfig.startup eq 'true'}">是</c:if>
					<c:if test="${lotteryConfig.startup eq 'false'}">否</c:if>
				</td>
				<td>
					<c:if test="${lotteryConfig.cost eq 'true'}">是</c:if>
					<c:if test="${lotteryConfig.cost eq 'false'}">否</c:if>
				</td>
				<td>
					<c:if test="${lotteryConfig.repeats eq 'true'}">是</c:if>
					<c:if test="${lotteryConfig.repeats eq 'false'}">否</c:if>
				</td>
				<td>
					<c:if test="${lotteryConfig.costScore eq null}">0</c:if>
		          	<c:if test="${lotteryConfig.costScore ne null}">
		          		<c:if test="${lotteryConfig.costScore eq 0}">0</c:if>
		          		<c:if test="${lotteryConfig.costScore ne 0}">
				       		<fmt:formatNumber value="${lotteryConfig.costScore/1000}" pattern="#,###.###"  minFractionDigits="3"/>
		          		</c:if>
		          	</c:if>
				</td>
				<%-- <td>${lotteryConfig.remarks}</td> --%>
				<shiro:hasPermission name="wechat:lotteryConfig:edit"><td>
    				<a href="${ctx}/wechat/lotteryConfig/form?id=${lotteryConfig.id}">修改</a>
					<shiro:hasPermission name="sys:user:edit"><a href="${ctx}/wechat/lotteryConfig/delete?id=${lotteryConfig.id}" onclick="return confirmx('确认要删除该抽奖配置吗？', this.href)">删除</a></shiro:hasPermission>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
